#include "OQLRangeCondition.h"
#include "ResolveDBRequest.h"

OQLRangeCondition::OQLRangeCondition()
{
}

OQLRangeCondition::~OQLRangeCondition()
{
}

std::string OQLRangeCondition::getName(){
	return "OQLRangeCondition";
}
ListPersistent OQLRangeCondition::resolve(std::string tabla)
{
	ListPersistent list;
	ResolveDBRequest res;
	
	table.assign(tabla);
	
	if(this->lsCondition.size() == 2)
	{
		OQLSimpleCondition * inf = (OQLSimpleCondition*)this->lsCondition[0];
		OQLSimpleCondition * sup = (OQLSimpleCondition*)this->lsCondition[1];
		
		if( inf->getValue() <= sup->getValue() && (inf->getOperator() == ">=" || inf->getOperator() == ">" ))
			list = res.resolverRange((*inf),(*sup));
	}
	
	return list;
}
